package gpstools.track;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * A section of a track
 * 
 * @author Marcin Skruch
 */
public class Lap implements Serializable {
    private static final long serialVersionUID = 1L;
    
    private final List<TrackPoint> points;
    private final LapInfo info = new LapInfo();

    public Lap() {
        this.points = new ArrayList<TrackPoint>();
    }

    public Lap(List<TrackPoint> points) {
        this.points = points;
    }

    public Lap add(TrackPoint point) {
        points.add(point);
        return this;
    }

    public boolean isEmpty() {
        return points.isEmpty();
    }

    public List<TrackPoint> getPoints() {
        return Collections.unmodifiableList(points);
    }
    
    public LapInfo getInfo() {
        return info;
    }
}
